embed youtube videos in posts

Posted by nevasport 
embed youtube videos in posts
November 08, 2006 10:53AM
Hello folks, is there any way to safely embed a youtube video in a post, it has been requested by my users and i think it is a good idea.

something like [youtube]videocode[/youtube]

what do you think?

thanks.
Re: embed youtube videos in posts
November 08, 2006 11:22AM
Seems quite simple:

[youtube]http://www.youtube.com/watch?v=k1fwPU2C_kk[/youtube]

should return this:

<object width="425" height="350"><param name="movie" value="[www.youtube.com] name="wmode" value="transparent"></param><embed src="[www.youtube.com]; type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
Re: embed youtube videos in posts
November 08, 2006 12:26PM
the simple text replacement module can do this.

Brian - Personal Blog
Re: embed youtube videos in posts
November 08, 2006 12:29PM
ok, i´ll check this out thank Brian.

BTW, I sent you an email a couple days ago.

Thanks.

Pepe
Re: embed youtube videos in posts
November 09, 2006 09:44AM
This seems to work using the Simple Text Replacement module.
Remember to change the comparison type from string to PCRE.

Paste the following in directly:

String to match:
[youtube\](.*?)[\/youtube\]

Replacement:
<object width="425" height="350"><param name="movie" value="\1"></param><param name="wmode" value="transparent"></param><embed src="\1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>

Hope this helps someone.
Also, if anyone can see a mistake, or possible security risk, please let me know!

/\dam

--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
Re: embed youtube videos in posts
November 09, 2006 09:47AM
If someone feels like posting the mods needed to add this tag to Maurice's enhanced text / smiley editor that would be appreciated! :D

/\dam

--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
Re: embed youtube videos in posts
January 08, 2007 03:19PM
Just enable HTML comments in your settings.. That should allow it...
hjp
Re: embed youtube videos in posts
February 10, 2007 07:36AM
I added two lines of code to the bbcode mod:


Add this line at the end of the $search = array(
      "/[video\](.+?)[\/video\]/is",

and following to the end of the $replace = array(
       
        "<embed style=\"width:400px; height:326px;\" id=\"VideoPlayback\" type=\"application/x-shockwave-flash\" src=\"$1\" flashvars=\"\"> </embed>",

To insert video to a message, just copy (only!) the Url from embedding-code between the videotags, like

[video]http://www.youtube.com/v/ekcYc3zrJHI[/video]

Works for youtube and google as well!
Re: embed youtube videos in posts
June 13, 2007 06:30AM
I wrote a module which can be used to display YouTube and Google URLs as embedded video

I discovered that there was more to it than the above to make it work easy for my users. Especially the fact that they will simply copy and paste video viewing page URLs instead of the actual video resource URLs, in which case the video would not load. That made it necessary to do some more work.

Currently, the module only supports YouTube and Google URLs, because I do not simply run [video] tag replacements but do some URL analyzing as well. Different video sources require different URL handling in my mod. Unknown resources are still displayed as a link to the video page.

See this thread for the module.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 06/13/2007 07:11AM by mmakaay.
Sorry, only registered users may post in this forum.

Click here to login